#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>


static struct resource my_tty_resource[] = {  
	[0] = {  
		.start = 0,  
		.end   = 128,  
		.flags = IORESOURCE_MEM,  
	},  
	[1] = {  
		.start = 1,  
		.end   = 1,  
		.flags = IORESOURCE_IRQ,  
	}  
};

struct platform_device my_tty_device = {
	.name	= VIRTUAL_DEVICE_NMAE,  
	.id	= -1,  
	.num_resources	= ARRAY_SIZE(my_tty_resource),  
	.resource	= my_tty_resource,  
	.dev		= {  
		.dma_mask       =    NULL,
		.coherent_dma_mask  = 0xffffffffUL 
	} 
};

static int my_tty_probe(struct platform_device *pdev)
{
	int ret = -1;

	return 0;  
}

static int my_tty_remove(struct platform_device *pdev)
{
	my_tty_exit (pdev);
	return 0;  
}

static void my_tty_shutdown(struct platform_device *pdev)
{
	my_tty_remove (pdev);
	return ;  
}

static int my_tty_suspend(struct platform_device *pdev, pm_message_t state)
{
	return 0;  
}

static int my_tty_resume(struct platform_device *pdev) 
{
	return 0;  
}

struct platform_driver my_tty_driver = {
	.probe      = my_tty_probe,
	.remove     = my_tty_remove,  
	.suspend    = my_tty_suspend,  
	.resume     = my_tty_resume,  
	.shutdown   = my_tty_shutdown,
	.id_table   = NULL,
	.driver     = {  
		.name   = VIRTUAL_DEVICE_NMAE,
		.owner  = THIS_MODULE,  
	},
};

static int __init my_driver_init (void)
{
	int ret = -1;
	ret = platform_device_register (&my_tty_device);
	if ( 0 != ret ) {
		return ret;
	}
	
	ret = platform_driver_register (&my_tty_driver);
	if ( 0 != ret ) {
		platform_device_unregister (&my_tty_device);
		return ret;
	}

	return 0;
}

static void __exit my_driver_exit (void)
{
	platform_device_unregister (&my_tty_device);
	platform_driver_unregister (&my_tty_driver);
	return;
}


module_init(my_tty_init);
module_exit(my_tty_exit);
MODULE_LICENSE("GPL");
